import httpRequest from '@/http/httpRequest'

// 获取产品名称列表
export const getName = () => {
  return httpRequest.get('/product/name')
}

// 获取产品列表
export const getList = (data) => {
  return httpRequest.post('/product/list', data)
}

// 条件查询产品
export const getByCondition = (data) => {
  return httpRequest.post('/product/get', data)
}

// 保存或更新产品
export const save = (data) => {
  return httpRequest.post('/product/save', data)
}

// 上传产品图片
export const uploadImage = (data) => {
  return httpRequest.post('/file/uploadFile', data, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 删除产品
export const deleteProduct = (id) => {
  return httpRequest.delete(`/product/delete/${id}`)
}

// 获取供应商列表
export const getSuppliers = () => {
  return httpRequest.get('/supplier/name')
}

// 获取产品分类列表
export const getCategories = () => {
  return httpRequest.get('/product-category/name')
} 